package com.beiding.test.pg;

import com.beiding.sqlbuilder.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PgSelectHandler implements SelectHandler {


    //TODO 算法应该封装
    @Override
    public String handle(String select, String from, String where, String on, String having) {

        if (select == null || from == null) {
            throw new RuntimeException("无效sql");
        }

        String sql = "select " + select + " from " + from;

        if (where != null) {
            sql += " where " + where;
        }

        if (on != null) {
            sql += " on " + on;
        }

        if (having != null) {
            sql += " having " + having;
        }

        return sql;
    }



}
